import { ref } from 'vue'
import { defineStore } from 'pinia'
import { Llm_id, Mode, Status,State } from '../utils/utils'

export const useStatusStore = defineStore('status', () => {
    const status = ref<Status>({ mode: Mode.code, llm_id: Llm_id.yiyan, state: State.loading }) 
    function changeMode(mode: Mode) {
        status.value.mode = mode
    }
    function getMode() {
        return status.value.mode
    }
    function isCodeMode() {
        return status.value.mode === Mode.code
    }
    function getLlmId() {
        return status.value.llm_id
    }
    function changeLlmId(llm_id: Llm_id) {
        console.log("llm_id",llm_id);
        
        status.value.llm_id = llm_id
    }
    function setStatus(newStatus: State){
        status.value.state = newStatus
    }
    function getStatus(){
        return status.value.state
    }
    return {
        status,
        changeMode,
        getMode,
        isCodeMode,
        getLlmId,
        changeLlmId,
        setStatus,
        getStatus,
    }
})